<template>
  <table class="table">
    <thead>
      <tr>
        <th v-for="(column, index) in columns" :key="index" v-text="column.title" :width="column.width"></th>
      </tr>
    </thead>
    <tbody>
      <tr v-if="!hasData">
        <td style="height: 50px" :colspan="columns.length">暂无数据</td>
      </tr>
      <slot></slot>
    </tbody>
  </table> 
</template>

<script>
export default {
  props: {
    columns: {
      type: Array,
      default() {
        return [
          {title: '企业名称', width: 'auto'},
          {title: '组织机构代码', width: 'auto'},
          {title: '法人代表', width: 'auto'},
          {title: '状态', width: 'auto'},
          {title: '操作', width: 'auto'}
        ]
      }
    },
    hasData: {
      type: Boolean,
      default: true
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
